package com.article.article_management;

import com.article.entity.pojo.ColumnList;
import com.article.mapper.ColumnMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class MyBatisPlusPage {


    @Autowired
    private ColumnMapper columnMapper;

    @Test
    public void testPage() {
        //分页查询
        Page<ColumnList> page = new Page<>(1, 5);
        Page<ColumnList> columnListPage = columnMapper.selectPage(page, null);
        // 获取分页查询结果
        System.out.println(columnListPage.getRecords());
        // 获取总记录数
        System.out.println(columnListPage.getTotal());
        // 获取总页数
        System.out.println(columnListPage.getPages());
        // 获取当前页码
        System.out.println(columnListPage.getCurrent());
        // 获取每页显示的记录数
        System.out.println(columnListPage.getSize());
        // 获取查询结果
        System.out.println(columnListPage.getRecords());

    }

}
